var baseURL = "../../";
var vm = new Vue({
    el: '#rrapp',
    data: {
        dateTime: '',
        date:'',
        lendAndReturn:[],
    },
    mounted:function(){
        this.date=new Date().getFullYear()+"年"+(new Date().getMonth()+1)+"月"+new Date().getMonth()+"日";
        this.initEchart();

    },
    methods: {
        initEchart:function () {
            var myChart = echarts.init(document.getElementById('lpeftmidbot'));
            option = {
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:60,
                    right:20,
                    top:45,
                    bottom:40
                },

                toolbox: {
                    feature: {
                        dataView: {show: true, readOnly: false},
                        magicType: {show: true, type: ['line', 'bar']},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                legend: {
                    top:10,
                    textStyle:{
                        fontSize: 10,
                        color:'rgba(255,255,255,.7)'
                    },
                    data:['实有人口','实有房屋','实有单位']
                },
                xAxis: [
                    {
                        type: 'category',
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.2)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.1)'
                            }
                        },
                        axisLabel:{
                            color:"rgba(255,255,255,.7)"
                        },

                        data: ['1','2','3','4','5','6','7','8','9','10','11','12'],
                        axisPointer: {
                            type: 'shadow'
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        name: '',
                        min: 0,
                        max: 250,
                        interval: 50,
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.3)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.01)'
                            }
                        },

                        axisLabel: {
                            formatter: '{value} ml'
                        }
                    },
                    {
                        type: 'value',
                        name: '',
                        max: 25,
                        interval: 5,
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,0)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,0)'
                            }
                        },
                        axisLabel: {
                            formatter: '{value} °C'
                        }
                    }
                ],
                series: [

                    {
                        name:'实有人口',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#b266ff'},
                                        {offset: 1, color: '#121b87'}
                                    ]
                                )
                            }
                        },
                        data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
                    },
                    {
                        name:'实有房屋',
                        type:'bar',

                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#00f0ff'},
                                        {offset: 1, color: '#032a72'}
                                    ]
                                )
                            }
                        },
                        data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
                    },
                    {
                        name:'实有单位',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#fffb34'},
                                        {offset: 1, color: '#032a72'}
                                    ]
                                )
                            }
                        },
                        data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
                    }
                ]
            };
            myChart.setOption(option);
            var myChart = echarts.init(document.getElementById('lpeftbot'));
            option = {
                color:['#d2d17c','#00b7ee', '#5578cf', '#5ebbeb', '#d16ad8','#f8e19a',  '#00b7ee', '#81dabe','#5fc5ce'],
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:20,
                    right:20,
                    top:0,
                    bottom:20
                },
                legend: {
                    top:10,
                    textStyle:{
                        fontSize: 10,
                        color:'rgba(255,255,255,.7)'
                    },
                    data:['男','女']
                },
                series : [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '55%'],
                        data:[
                            {value:335, name:'男'},
                            {value:310, name:'女'}

                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('pleftbox2top'));
            option = {
                color:['#d2d17c','#00b7ee', '#5578cf', '#5ebbeb', '#d16ad8','#f8e19a',  '#00b7ee', '#81dabe','#5fc5ce'],
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:20,
                    right:20,
                    top:0,
                    bottom:20
                },
                legend: {
                    top:10,
                    textStyle:{
                        fontSize: 10,
                        color:'rgba(255,255,255,.7)'
                    },
                    data:['藏族','回族','彝族','汉族','土家族']
                },
                series : [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '55%'],
                        data:[
                            {value:335, name:'藏族'},
                            {value:310, name:'回族'},
                            {value:234, name:'彝族'},
                            {value:135, name:'汉族'},
                            {value:158, name:'土家族'}

                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('pleftbox2midd'));
            option = {
                color:['#d2d17c','#00b7ee', '#5578cf', '#5ebbeb', '#d16ad8','#f8e19a',  '#00b7ee', '#81dabe','#5fc5ce'],
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:20,
                    right:20,
                    top:0,
                    bottom:20
                },
                legend: {
                    top:10,
                    textStyle:{
                        fontSize: 10,
                        color:'rgba(255,255,255,.7)'
                    },
                    data:['0-6','6-18','18-28','28-55','55以上']
                },
                series : [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '65%'],
                        data:[
                            {value:335, name:'0-6'},
                            {value:310, name:'6-18'},
                            {value:234, name:'18-28'},
                            {value:135, name:'28-55'},
                            {value:158, name:'55以上'}

                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('pmrboxbottom'));
            option = {
                color:['#d2d17c','#00b7ee', '#5578cf', '#5ebbeb', '#d16ad8','#f8e19a',  '#00b7ee', '#81dabe','#5fc5ce'],
                backgroundColor: 'rgba(1,202,217,.2)',
                legend: {
                    top:10,
                    textStyle:{
                        fontSize: 10,
                        color:'rgba(255,255,255,.7)'
                    },
                    data:['涉恐人员','涉稳人员','涉毒人员','在逃人员','重点上访人员','肇事肇祸精神病人','刑事犯罪前科人员']
                },
                grid: {
                    left: 10,
                    right: 10,
                    top: 40,
                    bottom: 10,
                    containLabel: true
                },

                xAxis : [
                    {
                        type : 'category',
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.3)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.01)'
                            }
                        },
                        data : ['康定市','泸定县','丹巴县','九龙县','新龙县','巴塘县','得荣县','理塘县','甘孜县','道孚县','德格县','色达县']
                    }
                ],
                yAxis : [
                    {
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.3)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.01)'
                            }
                        },

                        axisLabel: {
                            formatter: '{value} ml'
                        },
                        type : 'value'
                    }

                ],
                series : [

                    {
                        name:'涉恐人员',
                        type:'bar',
                        barWidth :30,
                        stack: '搜索引擎',
                        data:[620, 732, 701, 734, 1090, 1130, 1120,620, 732, 701, 734, 1090,]
                    },
                    {
                        name:'涉稳人员',
                        type:'bar',
                        stack: '搜索引擎',
                        data:[120, 132, 101, 134, 290, 230, 220, 101, 134, 290, 230, 220]
                    },
                    {
                        name:'涉毒人员',
                        type:'bar',
                        stack: '搜索引擎',
                        data:[60, 72, 71, 74, 190, 130, 110, 71, 74, 190, 130, 110]
                    },
                    ,
                    {
                        name:'在逃人员',
                        type:'bar',
                        stack: '搜索引擎',
                        data:[120, 132, 101, 134, 290, 230, 220, 101, 134, 290, 230, 220]
                    },
                    {
                        name:'重点上访人员',
                        type:'bar',
                        stack: '搜索引擎',
                        data:[60, 72, 71, 74, 190, 130, 110, 71, 74, 190, 130, 110]
                    },
                    {
                        name:'肇事肇祸精神病人',
                        type:'bar',
                        stack: '搜索引擎',
                        data:[60, 72, 71, 74, 190, 130, 110, 71, 74, 190, 130, 110]
                    },
                    {
                        name:'重大刑事犯罪前科人员',
                        type:'bar',
                        stack: '搜索引擎',
                        data:[62, 82, 91, 84, 109, 110, 120, 91, 84, 109, 110, 120]
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('pleftbox2bott_cont'));
            option = {
                color:['#7ecef4'],
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:40,
                    right:20,
                    top:30,
                    bottom:0,
                    containLabel: true
                },

                xAxis: {
                    type: 'value',
                    axisLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,0)'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,0)'
                        }
                    },
                    axisLabel:{
                        color:"rgba(255,255,255,0)"
                    },
                    boundaryGap: [0, 0.01]
                },
                yAxis: {
                    type: 'category',
                    axisLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.5)'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.1)'
                        }
                    },
                    axisLabel:{
                        color:"rgba(255,255,255,.5)"
                    },
                    data: ['务农','建筑工','技工','销售','职工']
                },
                series: [
                    {
                        name: '2011年',
                        type: 'bar',
                        barWidth :20,
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    1, 0, 0, 1,
                                    [
                                        {offset: 0, color: 'rgba(230,253,139,.7)'},
                                        {offset: 1, color: 'rgba(41,220,205,.7)'}
                                    ]
                                )
                            }
                        },
                        data: [18203, 23489, 29034, 104970, 131744]
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('prbottom_box1'));
            option = {
                color:['#d2d17c','#7fd7b1', '#5578cf', '#5ebbeb', '#d16ad8','#f8e19a',  '#00b7ee', '#81dabe','#5fc5ce'],
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:20,
                    right:30,
                    top:0,
                    bottom:20
                },
                legend: {
                    top: 5,

                    textStyle:{
                        fontSize:10,
                        color:'rgba(255,255,255,.6)'
                    },
                    data:['男','女','总数']
                },
                grid: {
                    left:20,
                    right:30,
                    top:40,
                    bottom:10,
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    axisLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.2)'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.1)'
                        }
                    },
                    axisLabel:{
                        color:"rgba(255,255,255,.7)"
                    },
                    data: ['0-6','6-18','18-28','28-55','55以上']
                },
                yAxis: {
                    type: 'value',
                    axisLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.2)'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.1)'
                        }
                    },
                    axisLabel:{
                        color:"rgba(255,255,255,.7)"
                    },
                },
                series: [
                    {
                        name:'男',
                        type:'line',
                        stack: '总量',
                        areaStyle: {normal: {}},
                        data:[120, 132, 101, 134, 90]
                    },
                    {
                        name:'女',
                        type:'line',
                        stack: '总量',
                        data:[220, 182, 191, 234, 290]
                    },
                    {
                        name:'总数',
                        type:'line',
                        stack: '总量',
                        data:[150, 232, 201, 154, 190]
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('prbottom_box2'));
            option = {
                backgroundColor: 'rgba(1,202,217,.2)',
                color:['#7ecef4','#7fd7b1'],
                grid: {
                    left:30,
                    right:20,
                    top:20,
                    bottom:40
                },
                xAxis: {
                    axisLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.7)'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.1)'
                        }
                    },
                    data: ['涉恐','涉稳','涉毒','重点','肇事','重大']
                },
                yAxis: {
                    axisLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.2)'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(255,255,255,.1)'
                        }
                    }
                },
                series: [{
                    symbolSize: 20,
                    data: [
                        [0.0, 8.04],
                        [2.0, 6.95],
                        [3.0, 7.58],
                        [5.0, 8.81],
                        [0.4, 8.33],
                        [4.0, 1.96],
                        [0.3, 7.24],
                        [4.6, 4.26],
                        [2.0, 4.84],
                        [2.0, 4.82],
                        [5.0, 5.68]
                    ],
                    type: 'scatter'
                }]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('prbottom_box3'));
            option = {
                backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:60,
                    right:20,
                    top:40,
                    bottom:40
                },

                toolbox: {
                    feature: {
                        dataView: {show: true, readOnly: false},
                        magicType: {show: true, type: ['line', 'bar']},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                legend: {
                    top:10,
                    textStyle:{
                        fontSize: 10,
                        color:'rgba(255,255,255,.7)'
                    },
                    data:['男','女','总数']
                },
                xAxis: [
                    {
                        type: 'category',
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.2)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.1)'
                            }
                        },
                        axisLabel:{
                            color:"rgba(255,255,255,.7)"
                        },

                        data: ['0-6','6-18','18-28','28-55','55以上'],
                        axisPointer: {
                            type: 'shadow'
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        name: '',
                        min: 0,
                        max: 250,
                        interval: 50,
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.3)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,.01)'
                            }
                        },

                        axisLabel: {
                            formatter: '{value} ml'
                        }
                    },
                    {
                        type: 'value',
                        name: '',
                        max: 25,
                        interval: 5,
                        axisLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,0)'
                            }
                        },
                        splitLine:{
                            lineStyle:{
                                color:'rgba(255,255,255,0)'
                            }
                        }
                    }
                ],
                series: [

                    {
                        name:'男',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#b266ff'},
                                        {offset: 1, color: '#121b87'}
                                    ]
                                )
                            }
                        },
                        data:[2.0, 4.9, 7.0, 23.2, 25.6]
                    },
                    {
                        name:'女',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#00f0ff'},
                                        {offset: 1, color: '#032a72'}
                                    ]
                                )
                            }
                        },
                        data:[8.6, 5.9, 9.0, 26.4, 28.7]
                    },
                    {
                        name:'总数',
                        type:'bar',
                        itemStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#fffb34'},
                                        {offset: 1, color: '#032a72'}
                                    ]
                                )
                            }
                        },
                        yAxisIndex: 1,
                        data:[6.0, 5.2, 3.3, 4.5, 6.3]
                    }
                ]
            };
            myChart.setOption(option);

            var myChart = echarts.init(document.getElementById('pmrmidd'));
            option = {
                color:['#f1ff00','#00c1ff', '#61a0a8', '#d48265', '#91c7ae','#749f83',  '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3'],
                // backgroundColor: 'rgba(1,202,217,.2)',
                grid: {
                    left:20,
                    right:20,
                    top:30,
                    bottom:30
                },
                radar: {
                    name: {
                        textStyle: {
                            fontSize: 10,
                            color: 'rgba(255,255,255,.8)'
                        }
                    },
                    splitLine: {
                        lineStyle: {
                            color: [
                                'rgba(1,202,217,.01)', 'rgba(1,202,217,.01)'
                            ].reverse()
                        }
                    },
                    splitArea: {
                        show: false
                    },
                    axisLine: {
                        lineStyle: {
                            color: 'rgba(1,202,217,.7)'
                        }
                    },
                    indicator: [
                        { name: '红色警情', max: 6500},
                        { name: '橙色警情', max: 16000},
                        { name: '黄色警情', max: 30000},
                        { name: '绿色警情', max: 44000}
                    ]
                },
                series: [{
                    name: '',
                    type: 'radar',
                    radius : [5, 100],
                    center: ['50%', '50%'],
                    data : [
                        {
                            value : [4300, 10000, 28000, 19000],
                            name : ''
                        },
                        {
                            value : [5000, 14000,  22000, 41000],
                            name : ''
                        }
                    ]
                }]
            };
            myChart.setOption(option);
        },
        //初始化出入库
        initLendAndReturn:function () {
            $.ajax({
                type: "GET",
                url: baseURL + "/analysis/lendAndReturn",
                contentType: "application/json",
                success: function(r){
                    if(r.code === 0){
                        vm.lendAndReturn=r.list;
                        vm.dateTime=(new Date().getFullYear())+'年'+(new Date().getMonth()+1)+"月"
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        //初始化温度
        initTemperature:function () {
            $.ajax({
                type: "GET",
                url: baseURL + "/analysis/queryReport/1",
                contentType: "application/json",
                success: function(r){
                    if(r.code === 0){
                        var year=new Date().getFullYear();

                        var myChart = echarts.init(document.getElementById('aleftboxtmidd'));
                        var  option = {
                            color:['#7de494','#7fd7b1', '#5578cf', '#5ebbeb', '#d16ad8','#f8e19a',  '#00b7ee', '#81dabe','#5fc5ce'],
                            backgroundColor: 'rgba(1,202,217,.2)',
                            grid: {
                                left: '5%',
                                right: '8%',
                                bottom: '7%',
                                top:'8%',
                                containLabel: true
                            },
                            tooltip: {
                                trigger: 'axis',
                                formatter:function(params, ticket, callback) {
                                    console.log(params[0])
                                    var date=new Date(params[0].name);
                                    return  date.getMonth()+1+'月'+ date.getDate()+'日'+ date.getHours()+'时'+ "<br />" +
                                        params[0].value+'℃';
                                }
                            },
                            toolbox: {
                                feature: {
                                    saveAsImage: {}
                                }
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                axisLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.2)'
                                    }
                                },
                                splitLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.1)'
                                    }
                                },
                                axisLabel:{
                                    color:"rgba(255,255,255,.7)",
                                    formatter: function (value, idx) {
                                        var date = new Date(value);
                                        return date.getHours();
                                    }
                                },
                                data:  r.list[0]
                            },
                            yAxis: {
                                type: 'value',
                                axisLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.2)'
                                    }
                                },
                                splitLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.1)'
                                    }
                                },
                                axisLabel:{
                                    color:"rgba(255,255,255,.7)"
                                },
                            },
                            series: [
                                {
                                    name:'温度',
                                    type:'line',
                                    stack: '摄氏度',
                                    areaStyle: {normal: {}},
                                    data: r.list[1]
                                }

                            ]
                        };
                        myChart.setOption(option);
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        //初始化湿度
        initHumidity:function () {
            $.ajax({
                type: "GET",
                url: baseURL + "/analysis/queryReport/2",
                contentType: "application/json",
                success: function(r){
                    if(r.code === 0){
                        var year=new Date().getFullYear();

                        var myChart = echarts.init(document.getElementById('aleftboxtbott'));
                        var option = {

                            tooltip: {
                                trigger: 'axis',
                                formatter:function(params, ticket, callback) {
                                    console.log(params[0])
                                    var date=new Date(params[0].name);
                                    return  date.getMonth()+1+'月'+ date.getDate()+'日'+ date.getHours()+'时'+ "<br />" +
                                        params[0].value+'RH';
                                }
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                feature: {
                                    saveAsImage: {}
                                }
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data:r.list[0],
                                axisLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.2)'
                                    }
                                },
                                splitLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.1)'
                                    }
                                },
                                axisLabel:{
                                    color:"rgba(255,255,255,.7)",
                                    formatter: function (value, idx) {
                                        var date = new Date(value);
                                        return date.getHours();
                                    }
                                },
                            },
                            yAxis: {
                                type: 'value',
                                axisLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.2)'
                                    }
                                },
                                splitLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.1)'
                                    }
                                },
                                axisLabel:{
                                    color:"rgba(255,255,255,.7)"
                                },
                            },
                            series: [
                                {
                                    name:'湿度',
                                    type:'line',
                                    smooth: true,
                                    stack: 'RH',
                                    data:r.list[1]
                                }

                            ]
                        };
                        myChart.setOption(option);
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        //初始化pm2.5
        initPM:function () {
            $.ajax({
                type: "GET",
                url: baseURL + "/analysis/queryReport/3",
                contentType: "application/json",
                success: function(r){
                    if(r.code === 0){
                        var year=new Date().getFullYear();
                        var myChart = echarts.init(document.getElementById('amiddboxtbott1'));
                        var option = {

                            tooltip: {
                                trigger: 'axis',
                                formatter:function(params, ticket, callback) {
                                    console.log(params[0])
                                    var date=new Date(params[0].name);
                                    return  date.getMonth()+1+'月'+ date.getDate()+'日'+ "<br />" +
                                        params[0].value+'ug/M3'+ "<br />" +
                                        '国家标准：75ug/M3';
                                }
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                feature: {
                                    saveAsImage: {}
                                }
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data:r.list[0],
                                axisLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.2)'
                                    }
                                },
                                splitLine:{
                                    lineStyle:{
                                        color:'rgba(255,255,255,.1)'
                                    }
                                },
                                axisLabel:{
                                    color:"rgba(255,255,255,.7)",
                                    formatter: function (value, idx) {
                                        var date = new Date(value);
                                        return date.getDate();
                                    }
                                },
                            },
                            yAxis:[{
                                type: 'value',
                                axisLine: {
                                    lineStyle: {
                                        color: 'rgba(255,255,255,.2)'
                                    }
                                },
                                splitLine: {
                                    lineStyle: {
                                        color: 'rgba(255,255,255,.1)'
                                    }
                                },
                                axisLabel: {
                                    color: "rgba(255,255,255,.7)"
                                }
                            },
                                {
                                    type: 'value',
                                    name: '',
                                    max: 25,
                                    interval: 5,
                                    axisLine:{
                                        lineStyle:{
                                            color:'rgba(255,255,255,.3)'
                                        }
                                    },
                                    splitLine:{
                                        lineStyle:{
                                            color:'rgba(255,255,255,.1)'
                                        }
                                    },
                                    axisLabel: {
                                        formatter: '{value} °C'
                                    }
                                }
                            ],
                            series: [
                                {
                                    name:'pm2.5',
                                    type:'line',
                                    smooth: true,
                                    stack: '2',
                                    data:r.list[1]
                                },
                                {
                                    name:'国家标准',
                                    type:'line',
                                    smooth: true,
                                    stack: '1',
                                    data:[75,75,75,75,75,75],
                                    itemStyle : {
                                        normal : {
                                            lineStyle:{
                                                color:'#00FF00'
                                            }
                                        }
                                    },

                                }

                            ]
                        };
                        myChart.setOption(option);
                    }else{
                        alert(r.msg);
                    }
                }
            });
        }
    }
});